package Models.enity;

import java.util.List;

public class Pagination {
    //分页数据条数
    public int PageSize;
    //当前页面
    public int CurrentPage;
    //全部页数=全部数据/分页数据条数
    public List<?> PageData;
    //所有页数
    public int AllPages;

    //数据从哪开始 = （当前页面-1）*分页数据条数
    public int skip;

    public Pagination(int pageSize,int currentPage){
        PageSize = pageSize;
        CurrentPage = currentPage;
        skip = (currentPage -1) * getPageSize();
    }
    public int getPageSize(){
        return  PageSize;
    }
    public void setPageSize(int size){
    }

    public int getCurrentPage(){
        return CurrentPage;
    }
    public void setAllPages(int AllPage){
        AllPages = AllPage/getPageSize() + (AllPage%getPageSize() == 0 ? 0:1);
    }
    public int getAllPages(){
        return AllPages;
    }
    public List<?> getPageData(){
        return PageData;
    }
}
